@{
    Layout = "";
}
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>@ViewData["Title"] - blog</title>

    <environment include="Development">
        <link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.css" />
    </environment>
    <environment exclude="Development">
        <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
              asp-fallback-href="~/lib/bootstrap/dist/css/bootstrap.min.css"
              asp-fallback-test-class="sr-only" asp-fallback-test-property="position" asp-fallback-test-value="absolute"
              crossorigin="anonymous"
              integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T"/>
    </environment>
    <link rel="stylesheet" href="~/css/site.css" />
</head>
<body>
    <div style="text-align:center;width:50%;margin-left:25%;margin-top:5%;margin-bottom:5%;padding:5%;background-color:#eee">
        <div style="margin:10px"><h3>My Sharp Blog</h3></div>
        <div class="container" style="text-align:left;">
            <form action="login/loginAjax" method="post" id="loginForm">
                <div class="form-group">
                    <label for="account">Account: </label>
                    <input type="text" value="@ViewBag.user_account_save" class="form-control" id="account" name="account" aria-describedby="accountHelp" placeholder="Enter account">
                    <small id="accountHelp" class="form-text text-muted">We'll never share your account with anyone else.</small>
                </div>
                <div class="form-group">
                    <label for="password">Password: </label>
                    <input type="password" value="@ViewBag.user_password_save" class="form-control" id="password" name="password" placeholder="Password">
                </div>
                <div class="form-check">
                    @{
                        if(ViewBag.save_account.Equals("true")) {
                            <input type="checkbox" class="form-check-input" id="saveAccount" name="saveAccount" value="true" checked>
                        } else {
                            <input type="checkbox" class="form-check-input" id="saveAccount" name="saveAccount" value="true">
                        }
                    }
                    <label class="form-check-label" for="saveAccount">Save Account</label>
                </div>
                <button id="b01" style="margin-top:10px;" type="button" class="btn btn-primary">Submit</button>
                <div id="myDiv" style="color:#f71c1c;font-size:14px"><p class="font-weight-light"></p></div>
            </form>
        </div>
    </div>
    <footer class="border-top footer text-muted">
        <div class="container">
            &copy; 2019 - blog - <a asp-area="" asp-controller="Home" asp-action="Privacy">Privacy</a>
        </div>
    </footer>

    <environment include="Development">
        <script src="~/lib/jquery/dist/jquery.js"></script>
        <script src="~/lib/bootstrap/dist/js/bootstrap.bundle.js"></script>
    </environment>
    <environment exclude="Development">
        <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"
                asp-fallback-src="~/lib/jquery/dist/jquery.min.js"
                asp-fallback-test="window.jQuery"
                crossorigin="anonymous"
                integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=">
        </script>
        <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.bundle.min.js"
                asp-fallback-src="~/lib/bootstrap/dist/js/bootstrap.bundle.min.js"
                asp-fallback-test="window.jQuery && window.jQuery.fn && window.jQuery.fn.modal"
                crossorigin="anonymous"
                integrity="sha384-xrRywqdh3PHs8keKZN+8zzc5TX0GRTLCcmivcbNJWm2rs5C8PRhcEn3czEjhAO9o">
        </script>
    </environment>
    <script src="~/js/site.js" asp-append-version="true"></script>
</body>

<script>
    $(document).ready(function(){
        $("#b01").click(function(){
            //alert(123)
            htmlobj=$.ajax({
                url:"/login/loginAjax",
                async:false,
                type:"POST",
                data:$('#loginForm').serialize(),
            });
            var result = JSON.parse(htmlobj.responseText);
            if(result.resultCode == "SUCCESS") {
                //alert("redirect");
                window.location.replace(result.data);
            }
            $("#myDiv > p").html(result.resultMsg);
        });
    });
</script>
